#include "conectiv.h"

//************************************
//**************Carga*****************
//************************************
void cargarConectivas(string cadena, Conectivas &conectivas){

    if(streq(cadena,"/\\")){
            conectivas=And;
    }else{
        if(streq(cadena,"\\/"))
                conectivas=Or;
        else{
            if(streq(cadena,"~"))
                    conectivas=Not;
            else{
                if(streq(cadena,"->"))
                    conectivas=entonces;
                else
                    conectivas=siysolosi;
            }
        }
    }
}

//************************************
//**************Desplegue*************
//************************************
void desplegaConectivas(Conectivas conectivas){
    switch (conectivas){
        case And: printf(" /\\ ");
                        break;
        case Or: printf(" \\/ ");
                        break;
        case Not: printf("~");
                        break;
        case entonces: printf(" -> ");
                        break;
        case siysolosi: printf(" <-> ");
                        break;
        default:;
    }
}

//************************************
//************Validacion**************
//************************************
bool esConectiva(string cadena){
    bool esConect=false;

    if(streq(cadena,"/\\")){
        esConect=true;
    }else{
        if(streq(cadena,"\\/"))
            esConect=true;
        else{
            if(streq(cadena,"~"))
                esConect=true;
            else{
                if(streq(cadena,"->"))
                    esConect=true;
                else
                    if(streq(cadena,"<->"))
                        esConect=true;
            }
        }
    }

    return esConect;
}

//************************************
//*************Auxiliar***************
//************************************
bool esConectivaNot(char caracter){
    bool esNot = false;
    if(caracter == '~')
        esNot = true;
    return esNot;
}




